package com.zhongshan.ga.mobile.resource;

import java.io.IOException;

import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;

import com.google.gson.JsonObject;
import com.zhongshan.ga.logger.GenerateLog;
import com.zhongshan.ga.mobile.logic.GetActivityInfoListLogic;

/**
 * 获取活动信息列表接口
 * 
 * @author kakaxi
 * 
 */
public class GetActivityInfoListResource extends ServerResource {

	@Get
	public Representation getActivityInfoList(Representation entity)
			throws IOException {
		GenerateLog.outDebug("调用了获得活动信息列表get的方法");
		entity = postActivityInfoList(entity);
		return entity;
	}

	@Post
	public Representation postActivityInfoList(Representation entity)
			throws IOException {
		if (entity == null) {
			return new StringRepresentation("访问有误");
		}

		GenerateLog.outDebug("调用了获得活动信息列表post的方法");
		GetActivityInfoListLogic logic = new GetActivityInfoListLogic();
		JsonObject resultJson = logic.getActivityInfoList(entity);
		return new StringRepresentation(resultJson.toString());
	}

}
